<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!-- Load the resource bundle -->

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Mobile.com</title>

    </h:head>
    <h:body>
        <ui:composition> 
            <c:set var="dsdt" value="#{ViewDT.DSDienThoai}" />
            <c:if test="${dsdt.size()!=0}">   
                <c:if test="${0>=ViewDT.trang}" >
                    <h:commandButton value="Truoc"  action="#{ViewDT.giamTrang}" disabled="true"/>
                </c:if>
                <c:if test="#{ViewDT.trang>0}">
                    <h:commandButton value="Truoc"  action="#{ViewDT.giamTrang}"/>
                </c:if>

                <h:outputLabel for="trang" value="Page: "/>
                <h:inputText value="${ViewDT.trang}" id="trang" disabled="true"/>

                <c:if test="${ViewDT.trang*16+16>dsdt.size()}">
                    <h:commandButton value="Sau"  action="#{ViewDT.TangTrang}" disabled="true"/>
                </c:if>
                <c:if test="#{dsdt.size()>= ViewDT.trang*16+16}">
                    <h:commandButton value="Sau"  action="#{ViewDT.TangTrang}"/>

                </c:if>
                <table width="746" border="1">
                    <c:forEach var ="ii" begin="0" end="3">
                        <tr>
                            <c:forEach var ="i" begin="0" end="3">
                                <c:set var="tt" value="${(ii*4+i+ ViewDT.trang*16)}"/>
                                <c:if test="${dsdt.size()>tt}">
                                    <c:set var="dt" value="#{dsdt.get(tt)}"/>  






                                    <td width="186" height="220" align="center" >



                                        <c:set var="madienthoai" value="${dt.madienthoai}"/>

                                        <h:commandLink action="#{detailmobile.setThongtin1sanpham(madienthoai)}">
                                            <h:graphicImage library="images"  name="${dt.hinhanh.replace('ô', 'o')}"  height="186" width="186"/>
                                        </h:commandLink>

                                        <br/>
                                        <br/>

                                        <c:set var="tendt" value="${dt.tendienthoai}"/>
                                        <c:set var="madt" value="${dt.madienthoai}"/>
                                        <h:outputText value="${tendt}"/><br/>

                                        <c:set var="giadt" value="${dt.giaban}"/>
                                        <br/>
                                        <h:outputText value="${dt.giaban}">
                                            <f:convertNumber type="currency"  currencyCode="VND" groupingUsed="true"  maxFractionDigits="0"/> 
                                        </h:outputText>
                                        <br/>
                                        <h:commandLink action="#{GioHang.setAddHangTrongGio(madt)}">
                                            <h:graphicImage library="images"  name="themvaogio.jpg"  />
                                        </h:commandLink>


                                    </td>
                                </c:if>
                            </c:forEach>
                        </tr>  
                    </c:forEach>
                </table>
            </c:if>
            <c:if test="${dsdt.size()==0}">  
                <h:outputText value="khong co dien thoai nao"/>
            </c:if>
        </ui:composition>
    </h:body>
</html>